package cn.bonoon.kernel.io.authority;

import cn.bonoon.kernel.io.FileManager;
import cn.bonoon.kernel.util.MD5Util;

public abstract class AbstractAuthorityRedirect {

	protected String password;
	protected String catalog;

	protected String urlParameter = FileManager.OPEN_REQUEST_PARAMETER;
	protected String urlAuthority = FileManager.OPEN_REQUEST_AUTHORITY;
	protected String urlTimestamp = FileManager.OPEN_REQUEST_TIMESTAMP;

	protected String combineSecret(String timestamp, String targetUrl){
		return MD5Util.getMD5(password + timestamp + targetUrl);
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	public void setCatalog(String catalog) {
		this.catalog = catalog;
	}
	
	public void setUrlAuthority(String urlAuthority) {
		this.urlAuthority = urlAuthority;
	}
	
	public void setUrlParameter(String urlParameter) {
		this.urlParameter = urlParameter;
	}
	
	public void setUrlTimestamp(String urlTimestamp) {
		this.urlTimestamp = urlTimestamp;
	}
}
